home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Utilities / BndNSUtl.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  17.0 KB  |  637 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        BndNSUtl.cp
  3.  
  4.     Contains:    Binding utilities for EditorSetup.
  5.  
  6.     Owned by:    Caia Grisar
  7.  
  8.     Copyright:    © 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     
  11. */
  12.  
  13. #ifndef _BNDNSUTL_
  14. #include "BndNSUtl.h"
  15. #endif
  16.  
  17. #ifndef _EDITRSET_
  18. #include "EditrSet.h"
  19. #endif
  20.  
  21. #ifndef _ODDEBUG_
  22. #include "ODDebug.h"
  23. #endif
  24.  
  25. #ifndef _ODMEMORY_
  26. #include "ODMemory.h"
  27. #endif
  28.  
  29. #ifndef SOM_ODValueNameSpace_xh
  30. #include "ValueNS.xh"
  31. #endif
  32.  
  33. #ifndef SOM_ODObjectNameSpace_xh
  34. #include "ObjectNS.xh"
  35. #endif
  36.  
  37. #ifndef _STORAGEU_
  38. #include "StorageU.xh"
  39. #endif
  40.  
  41. #ifndef _STDDEFS_
  42. #include "StdDefs.xh"
  43. #endif
  44.  
  45. #ifndef _STDPROPS_
  46. #include "StdProps.xh"
  47. #endif
  48.  
  49. #ifndef _STDTYPES_
  50. #include "StdTypes.xh"
  51. #endif
  52.  
  53. #ifndef _PART_
  54. #include "Part.xh"
  55. #endif
  56.  
  57. #ifndef SOM_ODValueIterator_xh
  58. #include <ValueItr.xh>
  59. #endif
  60.  
  61. #ifndef SOM_ODObjectIterator_xh
  62. #include <ObjctItr.xh>
  63. #endif
  64.  
  65. #ifndef _ISOSTR_
  66. #include "ISOStr.h"
  67. #endif
  68.  
  69. #ifndef SOM_ODStorageUnitView_xh
  70. #include <SUView.xh>
  71. #endif
  72.  
  73. #ifndef _EXCEPT_
  74. #include "Except.h"
  75. #endif
  76.  
  77. #ifndef _ODUTILS_
  78. #include <ODUtils.h>
  79. #endif
  80.  
  81. #ifndef SOM_ODNameSpaceManager_xh
  82. #include <NmSpcMg.xh>
  83. #endif
  84.  
  85. #ifndef SOM_ODTypeList_xh
  86. #include <TypeList.xh>
  87. #endif
  88.  
  89. #ifndef _STORUTIL_
  90. #include <StorUtil.h>
  91. #endif
  92.  
  93. #ifndef _NMSPCUTL_
  94. #include <NmSpcUtl.h>
  95. #endif
  96.  
  97. #ifndef _UTILERRS_
  98. #include <UtilErrs.h>
  99. #endif
  100.  
  101. #ifndef SOM_ODTypeListIterator_xh
  102. #include <TypLsItr.xh>
  103. #endif
  104.  
  105. #include <somcls.xh>
  106. #include <somcm.xh>
  107.  
  108.  
  109. //------------------------------------------------------------------------------
  110. // GetSysPrefEditorForKind
  111. //------------------------------------------------------------------------------
  112. // Returns the system-wide preferred editor for the argument data kind.
  113. // A null value is returned if no preference has been specified.
  114. // This routine checks to ensure that the preferred editor actually exists;
  115. // if it does not, the preference is canceled and null is returned.
  116.  
  117. ODEditor GetSysPrefEditorForKind(ODNameSpaceManager* theNmSpcMgr, 
  118.                                     ODType kind)
  119. {
  120.     ODEditor theEditor = kODNULL;
  121.     ODULong    valueLen;
  122.     ODBoolean sysPrefEditorFound = kODFalse;
  123.     
  124.     Environment* ev = somGetGlobalEnvironment();
  125.  
  126.         // look it up in the editorkinds namespace
  127.     ODValueNameSpace* sysPrefEditorKindsNameSpace = 
  128.         (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, 
  129.                                                         kODSysPrefEditorKinds );
  130.     if (sysPrefEditorKindsNameSpace)
  131.     {
  132.         sysPrefEditorFound = ValueNameSpaceGetEntry( 
  133.                                 sysPrefEditorKindsNameSpace, ev, kind, 
  134.                                 (ODPtr*) &theEditor, &valueLen );
  135.     }
  136.     return theEditor;
  137. }
  138.  
  139. //------------------------------------------------------------------------------
  140. // GetSysPrefEditorForCategory
  141. //------------------------------------------------------------------------------
  142. ODEditor GetSysPrefEditorForCategory(ODNameSpaceManager* theNmSpcMgr, 
  143.                                         ODType category)
  144. {
  145.     ODEditor theEditor = kODNULL;
  146.     ODULong    valueLen;
  147.     ODBoolean sysPrefEditorFound = kODFalse;
  148.     
  149.     Environment* ev = somGetGlobalEnvironment();
  150.  
  151.         // look it up in the editorkinds namespace
  152.     ODValueNameSpace* sysPrefEditorCategoriesNameSpace = 
  153.         (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, 
  154.                                                    kODSysPrefEditorCategories );
  155.     
  156.     if (sysPrefEditorCategoriesNameSpace)
  157.     {
  158.         sysPrefEditorFound = ValueNameSpaceGetEntry( 
  159.                                 sysPrefEditorCategoriesNameSpace, ev, category, 
  160.                                 (ODPtr*) &theEditor, &valueLen );
  161.     }
  162.     return theEditor;
  163. }
  164.  
  165. //------------------------------------------------------------------------------
  166. // SetSysPrefEditorForKind
  167. //------------------------------------------------------------------------------
  168. ODEditor SetSysPrefEditorForKind(ODNameSpaceManager* theNmSpcMgr, 
  169.                                     ODType kind, ODEditor editorString)
  170. {
  171.     ODEditor editor = kODNULL;
  172.     
  173.     Environment* ev = somGetGlobalEnvironment();
  174.  
  175.         // look it up in the editorkinds namespace
  176.     ODValueNameSpace* sysPrefEditorKindsNameSpace = 
  177.         (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, 
  178.                                                         kODSysPrefEditorKinds );
  179.     
  180.     if (sysPrefEditorKindsNameSpace)
  181.     {
  182.         ODULong strLength = ODISOStrLength((const ODISOStr)editorString);
  183.         editor = (ODEditor)ODNewPtrClear(strLength+1, kDefaultHeapID);
  184.         ODISOStrNCopy((ODISOStr)editor,(const ODISOStr)editorString, strLength);
  185.         ValueNameSpaceRegister( sysPrefEditorKindsNameSpace, ev, (ODISOStr)kind, 
  186.                                             (ODPtr)editor, strLength+1 );
  187.         theNmSpcMgr->UpdatePreferences(ev);
  188.     }
  189.     
  190.     return editor;
  191. }
  192.  
  193. //------------------------------------------------------------------------------
  194. // SetSysPrefEditorForCategory
  195. //------------------------------------------------------------------------------
  196. ODEditor SetSysPrefEditorForCategory(ODNameSpaceManager* theNmSpcMgr, 
  197.                                     ODType category,ODEditor editorString)
  198. {
  199.     ODEditor editor = kODNULL;
  200.     
  201.     Environment* ev = somGetGlobalEnvironment();
  202.  
  203.         // look it up in the editorkinds namespace
  204.     ODValueNameSpace* sysPrefEditorCategoriesNameSpace = 
  205.         (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, 
  206.                                                    kODSysPrefEditorCategories );
  207.     
  208.     if (sysPrefEditorCategoriesNameSpace)
  209.     {
  210.         ODULong strLength = ODISOStrLength((const ODISOStr)editorString);
  211.         editor = (ODEditor)ODNewPtrClear(strLength+1, kDefaultHeapID);
  212.         ODISOStrNCopy((ODISOStr)editor,(const ODISOStr)editorString, strLength);
  213.         ValueNameSpaceRegister( sysPrefEditorCategoriesNameSpace, ev, 
  214.                                 (ODISOStr)category, (ODPtr)editor, strLength+1);
  215.         theNmSpcMgr->UpdatePreferences(ev);
  216.     }
  217.     
  218.     return editor;
  219. }
  220.  
  221. //------------------------------------------------------------------------------
  222. // GetCategoriesOfKind
  223. //
  224. //     lookup kind in kindcategory namespace and return categories supported
  225. //------------------------------------------------------------------------------
  226.  
  227. ODTypeList* GetCategoriesOfKind(ODNameSpaceManager* theNmSpcMgr, 
  228.                                     ODType kind)
  229. {
  230.     ODTypeList*    categoryList = kODNULL;
  231.     
  232.     Environment* ev = somGetGlobalEnvironment();
  233.  
  234.         // look it up in the kindcategory namespace
  235.     ODObjectNameSpace* kindCategoryNameSpace = 
  236.         (ODObjectNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODKind );
  237.     
  238.     if (kindCategoryNameSpace)
  239.     {
  240.         if (kindCategoryNameSpace->GetEntry(ev, (ODISOStr)kind, 
  241.                                         (ODObject**)&categoryList ))
  242.             return categoryList;
  243.         else
  244.             return kODNULL;
  245.     }
  246.     return categoryList;
  247. }
  248.  
  249.  
  250. //------------------------------------------------------------------------------
  251. // GetUserKindFromKind
  252. //------------------------------------------------------------------------------
  253. ODBoolean GetUserKindFromKind( ODNameSpaceManager* theNmSpcMgr, 
  254.                                     ODType kind, ODName** name )
  255. {
  256.     ODBoolean    result  = kODFalse ;
  257.  
  258.     Environment* ev = somGetGlobalEnvironment();
  259.  
  260.         // look it up in the spaceName namespace
  261.     ODValueNameSpace* userStringNameSpace = 
  262.         (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODKindUserString );
  263.  
  264.     if (userStringNameSpace)
  265.         result = ValueNameSpaceGetODName(userStringNameSpace, ev, kind, name );
  266.     return result ;
  267. }
  268.  
  269.  
  270. //------------------------------------------------------------------------------
  271. // GetUserEditorFromEditor
  272. //------------------------------------------------------------------------------
  273. ODBoolean GetUserEditorFromEditor( ODNameSpaceManager* theNmSpcMgr, 
  274.                                     ODEditor editor, ODName** name )
  275. {
  276.     ODBoolean    result  = kODFalse ;
  277.  
  278.     Environment* ev = somGetGlobalEnvironment();
  279.  
  280.         // look it up in the spaceName namespace
  281.     ODValueNameSpace* userStringNameSpace = 
  282.         (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODEditorUserString );
  283.  
  284.     if (userStringNameSpace)
  285.         result = ValueNameSpaceGetODName(userStringNameSpace, ev, editor, name );
  286.     return result ;
  287. }
  288.  
  289.  
  290. //------------------------------------------------------------------------------
  291. // GetUserCatFromCat
  292. //------------------------------------------------------------------------------
  293. ODBoolean GetUserCatFromCat( ODNameSpaceManager* theNmSpcMgr, 
  294.                                     ODType category, ODName** name )
  295. {
  296.     ODBoolean    result  = kODFalse ;
  297.  
  298.     Environment* ev = somGetGlobalEnvironment();
  299.  
  300.         // look it up in the spaceName namespace
  301.     ODValueNameSpace* userStringNameSpace = 
  302.         (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODCategoryUserString );
  303.  
  304.     if (userStringNameSpace)
  305.         result = ValueNameSpaceGetODName(userStringNameSpace, ev, category, name );
  306.     return result ;
  307. }
  308.  
  309. //------------------------------------------------------------------------------
  310. // ODGetODOSTypeForKind
  311. //------------------------------------------------------------------------------
  312. ODOSType ODGetODOSTypeForKind(ODNameSpaceManager* theNmSpcMgr, 
  313.                                         ODType kind)
  314. {
  315.     ODOSType theOSType = kODNULL;
  316.     
  317.     Environment* ev = somGetGlobalEnvironment();
  318.  
  319.         // look it up in the editorkinds namespace
  320.     ODValueNameSpace* kindOldMacOSTypeNameSpace = 
  321.         (ODValueNameSpace*)theNmSpcMgr->HasNameSpace( ev, 
  322.                                                    kODKindOldMacOSType );
  323.     
  324.     if (kindOldMacOSTypeNameSpace)
  325.     {
  326.         ODOSType* typePtr;
  327.         ODULong    valueLen;
  328.         if (ValueNameSpaceGetEntry( 
  329.                                 kindOldMacOSTypeNameSpace, ev, kind, 
  330.                                 (ODPtr*) &typePtr, &valueLen ))
  331.         {
  332.             theOSType = *typePtr;
  333.             ODDeleteObject( typePtr );
  334.         }
  335.     }
  336.     return theOSType;
  337. }
  338.  
  339. //------------------------------------------------------------------------------
  340. // EditorSupportsKind
  341. //------------------------------------------------------------------------------
  342. ODBoolean EditorSupportsKind( ODNameSpaceManager* theNmSpcMgr,
  343.                                 ODEditor editor, ODType kind )
  344. {
  345.     ODTypeList*    kindsList = kODNULL;
  346.     Environment* ev = somGetGlobalEnvironment();
  347.  
  348.         // get the editorkinds namespace
  349.     ODObjectNameSpace* editorkindsNameSpace = 
  350.         (ODObjectNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODEditorKinds );
  351.     
  352.     if (editorkindsNameSpace)
  353.     {
  354.             // Lookup the kinds list by editor class ID
  355.         if (!editorkindsNameSpace->GetEntry( ev, (ODISOStr)editor, 
  356.                                     (ODObject**)&kindsList ))
  357.             kindsList = (ODTypeList*)kODNULL;
  358.     }
  359.  
  360.     return (kindsList && kindsList->Contains(ev, kind));
  361. }
  362.  
  363.  
  364. //------------------------------------------------------------------------------
  365. // GetAllEditorsForCategory
  366. //
  367. //     lookup kinds in editorkinds namespace and return editors supported
  368. //------------------------------------------------------------------------------
  369.  
  370. ODBoolean GetAllEditorsForCategory( ODNameSpaceManager* theNmSpcMgr,
  371.                                 ODType category, EditorSet* theEditorSet )
  372. {
  373.     ODTypeList* categoriesList;
  374.     ODBoolean retval = kODFalse;
  375.     ODULong    len;
  376.     
  377.     Environment* ev = somGetGlobalEnvironment();
  378.  
  379.     ODObjectNameSpace* kindCategories = 
  380.         (ODObjectNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODKind ) ;
  381.     if ( kindCategories )
  382.     {
  383.         ODObjectIterator* iter = kindCategories->CreateIterator(ev) ;
  384.         ODType kind ;
  385.  
  386.         for (iter->First(ev, (ODISOStr*)&kind, (ODObject**)&categoriesList, &len);
  387.                 iter->IsNotComplete(ev);
  388.                 iter->Next(ev, (ODISOStr*)&kind, (ODObject**)&categoriesList, &len))
  389.         {
  390.             if ( categoriesList && categoriesList->Contains( ev, category ) )
  391.             {
  392.                 EditorSet* thisEditorSet = new EditorSet() ;
  393.                 thisEditorSet->InitEditorSet();
  394.                 if ( GetAllEditorsForKind( theNmSpcMgr,
  395.                                             kind, thisEditorSet ) )
  396.                 {    
  397.                     theEditorSet->AddEditorSet( thisEditorSet ) ;
  398.                     retval = kODTrue;
  399.                 }
  400.                 ODDeleteObject( thisEditorSet );
  401.             }
  402.         }
  403.         ODDeleteObject( iter );
  404.     }
  405.     return retval ;
  406. }
  407.  
  408.  
  409. //------------------------------------------------------------------------------
  410. // GetAllEditorsForKind
  411. //
  412. //     lookup kinds in editorkinds namespace and return editors supported
  413. //------------------------------------------------------------------------------
  414.  
  415. ODBoolean GetAllEditorsForKind(ODNameSpaceManager* theNmSpcMgr,
  416.                                 ODType kind, EditorSet* theEditorSet)
  417. {
  418.     ODTypeList*    kindsList;
  419.     ODEditor         editor;
  420.     ODBoolean        retval = kODFalse;
  421.     ODULong            len;
  422.     
  423.     Environment* ev = somGetGlobalEnvironment();
  424.  
  425.     if (theEditorSet)
  426.     {
  427.             // get the editorkinds namespace
  428.         ODObjectNameSpace* editorkindsNameSpace = 
  429.             (ODObjectNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODEditorKinds );
  430.         
  431.         if (editorkindsNameSpace)
  432.         {
  433.                 //    iterate through editorKinds namespace
  434.             ODObjectIterator* iter = editorkindsNameSpace->CreateIterator(ev) ;
  435.             for (iter->First(ev, (ODISOStr*)&editor, (ODObject**)&kindsList, &len);
  436.                     iter->IsNotComplete(ev);
  437.                     iter->Next(ev, (ODISOStr*)&editor, (ODObject**)&kindsList, &len))
  438.             {
  439.                 if ( kindsList )
  440.                 {
  441.                     if ( kindsList->Contains(ev, kind) )
  442.                     {
  443.                         theEditorSet->AddEditor(editor);
  444.                         retval = kODTrue;
  445.                     }
  446.                     ODDisposePtr( editor );
  447.                 }
  448.             }
  449.             
  450.             ODDeleteObject( iter );
  451.         }
  452.     }
  453.     return retval;
  454. }
  455.  
  456. //------------------------------------------------------------------------------
  457. // GetAllKindsForEditor
  458. //------------------------------------------------------------------------------
  459.  
  460. void GetAllKindsForEditor(ODNameSpaceManager* theNmSpcMgr,
  461.                                 ODTypeList*    kindsList, ODEditor editor)
  462. {
  463.     ODType            kind = kODNULL;
  464.     ODTypeList*        nsKindsList = kODNULL;
  465.     
  466.     Environment* ev = somGetGlobalEnvironment();
  467.  
  468.     if (kindsList)
  469.     {
  470.             // get the editorkinds namespace
  471.         ODObjectNameSpace* editorkindsNameSpace = 
  472.             (ODObjectNameSpace*)theNmSpcMgr->HasNameSpace( ev, kODEditorKinds );
  473.         
  474.         if (editorkindsNameSpace)
  475.         {
  476.             if(editorkindsNameSpace->GetEntry( ev, (ODType)editor, 
  477.                                                      (ODObject**)&nsKindsList ))
  478.             {
  479.                 ODTypeListIterator* iter = nsKindsList->
  480.                                                      CreateTypeListIterator(ev);
  481.                 for (kind = iter->First(ev);
  482.                         iter->IsNotComplete(ev);
  483.                         kind = iter->Next(ev))
  484.                 {
  485.                     kindsList->AddLast(ev, kind);
  486.                     ODDisposePtr(kind);
  487.                 }
  488.                 
  489.                 ODDeleteObject( iter );
  490.             }
  491.         }
  492.     }
  493. }
  494.  
  495. //------------------------------------------------------------------------------
  496. // ReadSize
  497. //------------------------------------------------------------------------------
  498.  
  499. ODULong  ReadSize(ODFileRefNum file, ODStorageUnitView* view)
  500. {
  501.     ODULong data;
  502.     ODSLong length = sizeof(data);
  503.     ODSLong savedLength = length;
  504.     Environment* ev = somGetGlobalEnvironment ();
  505.  
  506.     if (view)
  507.         length = StorageUnitViewGetValue(view, ev, length, &data);
  508.     else
  509.         THROW_IF_ERROR(FSRead(file, &length, (long *)&data));
  510.  
  511.     if (savedLength != length)
  512.         THROW(kODErrReadErr);
  513.  
  514.     return data;
  515. }
  516.  
  517. //------------------------------------------------------------------------------
  518. // ReadBytes
  519. //------------------------------------------------------------------------------
  520.  
  521. void ReadBytes(ODFileRefNum file, ODStorageUnitView* view,
  522.                         ODPtr bytes, ODULong* length)
  523. {
  524.     ODSLong savedLength = *length;
  525.     Environment* ev = somGetGlobalEnvironment ();
  526.     
  527.     if (view)
  528.         *length = StorageUnitViewGetValue(view, ev, *length, bytes);
  529.     else
  530.         THROW_IF_ERROR(FSRead(file, (long *)length, bytes));
  531.  
  532.     if (savedLength != (ODSLong)*length)
  533.         THROW(kODErrReadErr);
  534. }
  535.  
  536.  
  537. //------------------------------------------------------------------------------
  538. // ODGetEditorSetFromResFile
  539. //------------------------------------------------------------------------------
  540.  
  541. EditorSet* ODGetEditorSetFromResFile(ODSShort resRefNum)
  542. {
  543.     EditorSet*     theEditorSet = kODNULL;
  544.     ODBoolean    editorFound = kODFalse;
  545.     
  546.     if( resRefNum != -1 ) {
  547.         TRY{
  548.             LOG("* Reading 'nmap's from file %hd\n",resRefNum);
  549.             ODSShort nmapCount = Count1Resources( kODNameMappings );
  550.             for (short i=1; i<=nmapCount; i++) 
  551.             {
  552.                     // Get the Resource
  553.                 ODHandle nmap = (ODHandle)Get1IndResource(kODNameMappings, i);
  554.                 ODError result = ResError();
  555.                 
  556.                 if ( nmap != nil && !result  )
  557.                 {
  558.                     ODLockHandle((ODHandle) nmap);
  559.  
  560.                     theEditorSet = ODGetEditorSetFromNMAP(nmap);
  561.                                              
  562.                     ReleaseResource( nmap );
  563.                 }
  564.                 
  565.                 if (theEditorSet)
  566.                     break;
  567.             }
  568.         }CATCH_ALL{
  569.             WARN("Error %ld reading nmaps for file %hd",ErrorCode(),resRefNum);
  570.         }ENDTRY
  571.     }
  572.     return theEditorSet;
  573. }
  574.  
  575. //------------------------------------------------------------------------------
  576. // ODGetEditorSetFromNMAP
  577. //------------------------------------------------------------------------------
  578.  
  579. EditorSet* ODGetEditorSetFromNMAP( ODHandle nmap )
  580. {
  581.     ODISOStr        nameSpaceName = kODNULL; ODVolatile(nameSpaceName);
  582.     ODUShort        nameLen;
  583.     ODISOStr        editor;
  584.     ODUShort        editorLen;
  585.     ODSize            bufferPos=(ODSize)*nmap;
  586.     ODUShort        editorCount;
  587.     ODSize            sizeShort = sizeof(ODUShort);
  588.     Environment*     ev = somGetGlobalEnvironment ();
  589.     EditorSet*         theEditorSet = kODNULL;
  590.     
  591.     ODBlockMove((ODPtr)bufferPos, (ODPtr)&nameLen, sizeShort);
  592.     bufferPos += sizeShort;
  593.  
  594.     TRY
  595.         nameSpaceName = (ODISOStr)ODNewPtrClear((ODSize)nameLen+1, kDefaultHeapID);
  596.         ODBlockMove((ODPtr)bufferPos, (ODPtr)nameSpaceName, (ODSize)nameLen);
  597.         bufferPos += (ODSize)nameLen;
  598.         
  599.         if (ODISOStrEqual( nameSpaceName, kODEditorUserString ))
  600.         {
  601.             ODBlockMove((ODPtr)bufferPos, (ODPtr)&editorCount, sizeShort);
  602.             bufferPos += sizeShort;
  603.             
  604.             if ( editorCount > 0 )
  605.             {
  606.                 theEditorSet = new EditorSet() ;
  607.                 theEditorSet->InitEditorSet();
  608.     
  609.                 for(ODUShort i=0; i < editorCount; i++)
  610.                 {
  611.                     ODBlockMove((ODPtr)bufferPos, (ODPtr)&editorLen, sizeShort);
  612.                     bufferPos += sizeShort;
  613.             
  614.                     editor = (ODISOStr)ODNewPtrClear((ODSize)editorLen+1, kDefaultHeapID);
  615.                     ODBlockMove((ODPtr)bufferPos, (ODPtr)editor, (ODSize)editorLen);
  616.                     bufferPos += (ODSize)editorLen;
  617.                     
  618.                     theEditorSet->AddEditor(editor);
  619.                     
  620.                         // skip over the corresponding UserString in the nmap
  621.                     bufferPos += sizeShort;
  622.                     bufferPos += sizeof(ScriptCode);
  623.                     bufferPos += sizeof(LangCode);
  624.                     ODBlockMove((ODPtr)bufferPos, (ODPtr)&nameLen, sizeShort);
  625.                     bufferPos += sizeShort;
  626.                     bufferPos += nameLen;
  627.                 }
  628.             }
  629.         }
  630.     CATCH_ALL
  631.         WARN("Error %ld in Read_nmap_buffer",ErrorCode());
  632.     ENDTRY
  633.     ODDisposePtr((ODPtr)nameSpaceName);
  634.     return theEditorSet;
  635. }
  636.  
  637.